// src/api/TravelRouteApi.ts
import { BaseApiClient } from '../BaseApi.ts';
import type { RoutePoint, RouteTransport, ApiResponse } from '../../types/DataTypes.ts';

// 旅行路线相关接口响应类型
export interface TravelRouteResponse {
    routePoints: RoutePoint[];
    routeTransports: RouteTransport[];
}

// 旅行路线相关API
export class TravelRouteApi extends BaseApiClient {
    constructor() {
        super();
    }

    /**
     * 获取顾客旅行路线
     * @param customerName 顾客姓名
     * @returns 包含路线点和交通信息的响应
     */
    async getCustomerTravelRoute(customerName: string): Promise<ApiResponse<TravelRouteResponse>> {
        return this.request<TravelRouteResponse>({
            method: 'GET',
            url: `/route/${encodeURIComponent(customerName)}`,
        });
    }
}

// 创建单例实例
export const travelRouteApi = new TravelRouteApi();

// 默认导出
export default travelRouteApi;